package com.qf.util;

import java.util.HashMap;

/**
 * @author sunyamei
 * @version V1.0
 * @Project shirodemo
 * @Package com.qf.util
 * @Description:
 * @Date 2022/7/19 21:06
 */
public class Result extends HashMap {
    private  int code;//状态 0 成功  1 失败 *****
    private  String msg;//响应的信息

    public Result(){}
    public Result(int code){
        super.put("code",code);
    }

    public Result(int code, String msg){
        super.put("code",code);
        super.put("msg",msg);
    }

    public  static Result ok(){
        return new Result(0);
    }
    public  static Result ok(String msg){
        return new Result(0,msg);
    }

    public  static Result error(){
        return new Result(1);
    }
    public  static Result error(String msg){
        return new Result(1,msg);
    }

    public Result put(String key, Object value){
        super.put(key,value);

        return this;
    }

}
